Skip to content

feat: add @pgsql/transform (SQL transformation, classification, qualification, closure) - #316

Merged
pyramation merged 1 commit into
mainfrom
feat/pgsql-transform
Jul 27, 2026
Merged

feat: add @pgsql/transform (SQL transformation, classification, qualification, closure)#316
pyramation merged 1 commit into
mainfrom
feat/pgsql-transform

Conversation

@pyramation

Copy link
Copy Markdown
Collaborator

Summary

Step 2 of constructive-io/constructive-planning#1271 (follows #315, which freed the name): moves constructive-db's transform-schemas into this monorepo as the new @pgsql/transform at 18.2.0 (continuing the 18.x line).

What moved (verbatim, minus path/doc tweaks):

  • transform.tstransformSql: schema-name rewriting across DDL/DML/grants/policies/comments and inside PL/pgSQL bodies (hydrated via plpgsql-parser)
  • facts.tsclassifyStatements / StatementFacts: per-statement kind + creates/references/referencedSchemas/roles/fkTargets/securityRelevant/securityDefiner/dynamicSql
  • qualify.tsqualifyUnqualified + inventory helpers
  • categorize.tsCategoryProfile / TIER_PROFILE / buildCategoryOf
  • fixture-closure.tsresolveFixtureClosure transitive dependency closure
  • round-trip-core.ts / round-trip.ts — dependency-free normalizeTree/cleanTree engine + mutation-aware round-trip validation
  • All 6 test suites (174 tests), __fixtures__ golden files, and the make-fixtures / scan-corpus / hunt-plpgsql-bugs scripts

Deliberately not moved: bundle-driver.ts (makeSchemaTranspiler / makeNamespaceValidator) — it depends on @pgpmjs/bundle and would invert layering; it relocates to the constructive repo in a follow-up. index.ts drops only those exports; everything else is unchanged.

Deps are all workspace-internal: @pgsql/quotes, @pgsql/traverse, plpgsql-parser (published deps ^18.x become workspace:*). Lockfile updated with a minimal hand-added importer block (full pnpm install rewrites the file due to formatting drift; pnpm install --frozen-lockfile verified green with pnpm 9 / node 20 as in CI).

Also: added @pgsql/transform to the CI test matrix, and package tables in README.md / AGENTS.md. Package README notes the old version-upgrade transformer now lives at @pgsql/transform-ast.

Verified locally: build + all 174 tests pass. Note: pnpm lint fails repo-wide on main too (ESLint 9 installed with legacy .eslintrc.json) — pre-existing, untouched here.

Follow-ups tracked in the planning issue: consume from constructive-db (delete transform-schemas, relocate bundle-driver), and redo the pgpm slicer-closure prototype on this package.

Link to Devin session: https://app.devin.ai/sessions/1aa52746e60c4df38ef2678d168269b9
Requested by: @pyramation

@pyramation pyramation self-assigned this Jul 27, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@pyramation
pyramation merged commit 6b98879 into main Jul 27, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant